package com.cssy.yd.logic.dao.impl;

import com.cssy.yd.logic.dao.LogicMesWareItemDAO;
import com.cssy.yd.logic.entity.LogicMesWareItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * ��ݷ��ʶ���ʵ����
 * @since 2013-08-28
 */
public class LogicMesWareItemDAOImpl extends SqlMapClientDaoSupport implements LogicMesWareItemDAO {

    /**
     * �������
     * @param logicMesWareItemDO
     * @return ������ݵ�����
     */
    public String insertLogicMesWareItemDO(LogicMesWareItemDO logicMesWareItemDO) {
        Object id = getSqlMapClientTemplate().insert("LogicMesWareItem.insert", logicMesWareItemDO);
        return (String) id;
    }

    /**
     * ͳ�Ƽ�¼��
     * @param logicMesWareItemDO
     * @return ����ļ�¼��
     */
    public Integer countLogicMesWareItemDOByExample(LogicMesWareItemDO logicMesWareItemDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicMesWareItem.countByDOExample", logicMesWareItemDO);
        return count;
    }

    /**
     * ���¼�¼
     * @param logicMesWareItemDO
     * @return ��Ӱ�������
     */
    public Integer updateLogicMesWareItemDO(LogicMesWareItemDO logicMesWareItemDO) {
        int result = getSqlMapClientTemplate().update("LogicMesWareItem.update", logicMesWareItemDO);
        return result;
    }

    /**
     * ��ȡ�����б�
     * @param logicMesWareItemDO
     * @return �����б�
     */
    @SuppressWarnings("unchecked")
    public List<LogicMesWareItemDO> findListByExample(LogicMesWareItemDO logicMesWareItemDO) {
        List<LogicMesWareItemDO> list = getSqlMapClientTemplate().queryForList("LogicMesWareItem.findListByDO", logicMesWareItemDO);
        return list;
    }

    /**
     * ��������ȡlogicMesWareItemDO
     * @param id
     * @return logicMesWareItemDO
     */
    public LogicMesWareItemDO findLogicMesWareItemDOByPrimaryKey(String id) {
        LogicMesWareItemDO logicMesWareItemDO = (LogicMesWareItemDO) getSqlMapClientTemplate().queryForObject("LogicMesWareItem.findByPrimaryKey", id);
        return logicMesWareItemDO;
    }

    /**
     * ɾ���¼
     * @param id
     * @return ��Ӱ�������
     */
    public Integer deleteLogicMesWareItemDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicMesWareItem.deleteByPrimaryKey", id);
        return rows;
    }

    @Override
	public List<LogicMesWareItemDO> find(SearchConditions scs)
			throws DataAccessException {
   		List<LogicMesWareItemDO> list = getSqlMapClientTemplate().queryForList("LogicMesWareItem_ex.find", scs);
   		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicMesWareItem_ex.count", scs);
	    return count;
	}

}